;~ Global Const $GUI_FONT = "Arial";_Setting_Load ("GUI_FONT")

Func _GUI_DrawWallpaper ()
	_GDIPlus_GraphicsDrawImageRect($hBuffer, $hWallpaperImage, 0, 0, 800, 600)
	_GDIPlus_GraphicsDrawRect($hBuffer, 0, 0, 799, 599)
EndFunc

Func _GUI_DrawButton_old ($sText = "", $iX = 0, $iY = 0, $iWidth = 100)
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hButtonImage, 0, 2, 4, 22, $iX, $iY, 4, 25)

;~ 	$count = ($iWidth - 8) / 18
;~ 	$iX += 4
;~ 	For $i = 0 To $count
;~ 		_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hButtonImage, 4, 2, 18, 22, $iX + $i*18, $iY, 18, 25)
;~ 	Next
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hButtonImage, 4, 2, 18, 22, $iX + 4, $iY, $iWidth - 8, 25)
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hButtonImage, 22, 2, 4, 22, $iX + ($iWidth - 4), $iY, 4, 25)
	_GDIPlus_GraphicsDrawString($hBuffer, $sText, $iX + 3, $iY + 3)
EndFunc

Func _GUI_DrawButton ($sText = "", $iX = 0, $iY = 0, $iWidth = 100)
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hButtonImage, 11, 0, 120, 40, $iX , $iY, $iWidth, 30)
	_GUI_DrawString($sText, $iX + 4, $iY + 6)
EndFunc

Func _GUI_DrawString($sString, $nX, $nY, $nSize = 10, $iFormat = 0)
	_GDIPlus_GraphicsDrawString($hBuffer, $sString, $nX, $nY, "Arial", $nSize, $iFormat)
EndFunc

Func _GUI_DrawInput ($sText = "", $iX = 0, $iY = 0, $iWidth = 100, $bIsActive = False)
	$iTypeInDelay = 50
	_GDIPlus_GraphicsFillRect($hBuffer, $iX, $iY, $iWidth, 25, $hButtonBrush)
	_GDIPlus_GraphicsDrawRect($hBuffer, $iX, $iY, $iWidth, 25)
	If $bIsActive Then
		_GDIPlus_GraphicsDrawString($hBuffer, $sText & "|", $iX + 3, $iY + 3)
		Select
			Case  _IsPressed (41)
					$sText &= "a"
			Case  _IsPressed (42)
					$sText &= "b"
			Case  _IsPressed (43)
					$sText &= "c"
			Case  _IsPressed (44)
					$sText &= "d"
			Case  _IsPressed (45)
					$sText &= "e"
			Case  _IsPressed (46)
				$sText &= "f"
			Case  _IsPressed (47)
				$sText &= "g"
			Case  _IsPressed (48)
				$sText &= "h"
			Case  _IsPressed (49)
				$sText &= "i"
	        Case  _IsPressed ('4A')
				$sText &= "j"
			Case  _IsPressed ('4B')
				$sText &= "k"
			Case  _IsPressed ('4C')
				$sText &= "l"
			Case  _IsPressed ('4D')
				$sText &= "m"
			Case  _IsPressed ('4E')
				$sText &= "n"
			Case  _IsPressed ('4F')
				$sText &= "o"
			Case  _IsPressed (50)
				$sText &= "p"
			Case  _IsPressed (51)
				$sText &= "q"
			Case  _IsPressed (52)
				$sText &= "r"
			Case  _IsPressed (53)
				$sText &= "s"
			Case  _IsPressed (54)
				$sText &= "t"
			Case  _IsPressed (55)
				$sText &= "u"
			Case  _IsPressed (56)
				$sText &= "v"
			Case  _IsPressed (57)
				$sText &= "w"
			Case  _IsPressed (58)
				$sText &= "x"
			Case  _IsPressed (59)
				$sText &= "y"
			Case  _IsPressed ('5A')
				$sText &= "z"
			EndSelect
	Else
		_GDIPlus_GraphicsDrawString($hBuffer, $sText, $iX + 3, $iY + 3)
	EndIf
	Return $sText
EndFunc

Func _GUI_MsgBox ($sTitle, $sText)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFF00007F)
    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate("Arial Black")
    Local $hFont = _GDIPlus_FontCreate($hFamily, 12, 2)
    Local $tLayout = _GDIPlus_RectFCreate(302, 252, 0, 0)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($hBuffer, $sTitle, $hFont, $tLayout, $hFormat)


	_GDIPlus_GraphicsFillRect($hBuffer, 300, 250, 200, 100)
	_GDIPlus_GraphicsDrawRect($hBuffer, 300, 250, 200, 100, $hBrush)
    _GDIPlus_GraphicsDrawStringEx($hBuffer, $sTitle, $hFont, $aInfo[0], $hFormat, $hBrush)

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)

EndFunc

Func _GUI_DrawWindow ($sTitle = "", $iX = 0, $iY = 0, $iW = 100, $iH = 100)
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hWindowImage, 0, 0, 10, 10, $iX, $iY, 10, 10); obere linke ecke
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hWindowImage, 11, 0, 127, 10, $iX + 10, $iY, $iW - 22, 10); oberer balken
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hWindowImage, 139, 0, 12, 10, $iX + $iW - 12, $iY, 12, 10); obere rechte ecke
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hWindowImage, 0, 11, 10, 81, $iX, $iY + 10, 10, $iH - 22);linke seite
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hWindowImage, 139, 11, 10, 81, $iX + $iW - 12, $iY + 10, 10, $iH - 22);rechte seite
	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hWindowImage, 11, 11, 127, 81, $iX + 10, $iY + 10, $iW - 22, $iH - 22);mitte
;~ 	_GDIPlus_GraphicsDrawImageRectRect($hBuffer, $hWindowImage, 11, 93, 127, 10, $iX + 10, $iY, $iW - 12, $iH - 22);unterer balken
EndFunc

Func _GUI_Render ()
	_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
EndFunc